//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    temp: null,
    lowhigh: null,
    type: null,
    city: null,
    date: null,
    direction: '持续无风向',
    temperature: null,
    condition: '10',
    futureArray: '[]',
  },

  onLoad:function(){
    var that = this
    wx.request({
      url: 'http://apis.juhe.cn/simpleWeather/query',
      data:{
        'city':'成都',
        'key': '95d67ee5daff3a22594eb92ce1b7d21b'
      },
      success: function (res) {
        console.log(res.data.result);
        that.setData({
          city: res.data.result.city,
          temp: res.data.result.realtime.temperature,
          type: res.data.result.realtime.info,
          direction: res.data.result.realtime.direct,
          temperature: res.data.result.future[0].temperature,
          date: res.data.result.future[0].date,
          futureArray: res.data.result.future
        })
      },
      // fail:function(res){
      //   console.log(res)
      // }
    })
  }


})
